<?php
$this->breadcrumbs=array(
	t('Member','web')=>'/member/index/index',
	'店铺管理'=>'/member/registercompany',
	'我要开店'=>'/member/registercompany',
);?>

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'company-form-form',
	'enableAjaxValidation'=>false,
	'htmlOptions'=>array('class'=>'shop_set'),
)); ?>
	<ul class="form_list form_list2">
		<li class="c_f"><span class="tit">主营类目：</span>
			<div class="cont f_l"><span class="ff_s">
				<?php if($model->category->zca_topid!=0){?>
					<?php echo CHtml::encode(Category::model()->getTitle($model->category->zca_topid))?>&gt; 
				<?php }?>
				<?php if($model->category->zca_parentid!=0){?>
					<?php echo  CHtml::encode(Category::model()->getTitle($model->category->zca_parentid))?> &gt; 
				<?php }?>
					<?php echo  CHtml::encode(Category::model()->getTitle($model->category->zca_id))?>
			</span></div>
		</li>
		<li class="c_f"><span class="tit"><em class="xing">*</em>店铺名称：</span>
			<div class="cont f_l">
				<?php echo $form->textField($model,'zc_name',array('class'=>'s_ipt w_250','maxlength'=>'30')); ?>
				<?php echo $form->error($model,'zc_name'); ?>
			</div>
		</li>
		<li class="c_f"><span class="tit">二级域名：</span>
			<div class="cont f_l">
				<?php echo $form->textField($model,'zc_sub_domain',array('class'=>'s_ipt w_250')); ?>
				<?php echo $form->error($model,'zc_sub_domain'); ?>
			</div>
		</li>
		<li class="c_f"><span class="tit"><em class="xing">*</em>所在地区：</span>
			<div class="cont f_l">
				<?php Area::getAreainfo('Company',$model->zar_id,'s_ipt w_80'); ?>
				<?php echo $form->error($model,'zar_id'); ?>
			</div>
		</li>
		<li class="c_f"><span class="tit">街道地址：</span>
			<div class="cont f_l">
				<?php echo $form->textField($model,'zc_adr',array('class'=>'s_ipt w_250')); ?>
				<?php echo $form->error($model,'zc_adr'); ?>
			</div>
		</li>
		<li class="c_f"><span class="tit"><em class="xing">*</em>邮政编码：</span>
			<div class="cont f_l">
				<?php echo $form->textField($model,'zc_zip',array('class'=>'s_ipt w_170')); ?>
				<?php echo $form->error($model,'zc_zip'); ?>
			</div>
		</li>
		<li class="c_f"><span class="tit">主营产品：</span>
			<div class="cont f_l">
				<?php echo $form->textField($model,'zc_main_pro',array('class'=>'s_ipt w_250')); ?>
				<?php echo $form->error($model,'zc_main_pro'); ?>
			</div>
		</li>
		<li class="c_f"><span class="tit">店铺描述：</span>
			<div class="cont f_l">
				<?php echo $form->textArea($model,'zc_seodesc',array('class'=>'t_area')); ?>
				<?php echo $form->error($model,'zc_seodesc'); ?>
			</div>
		</li>
		<li class="c_f"><span class="tit">&nbsp;</span>
			<div class="cont f_l"><?php echo CHtml::submitButton("保存设置",array('class'=>'mem_btn mem_btn05'))?></div>
		</li>
	</ul>
<?php $this->endWidget(); ?>

<script src="<?php echo Yii::app()->baseUrl;?>/js/jquery.ui.widget.js"></script>  
<script src="<?php echo Yii::app()->baseUrl;?>/js/jquery.iframe-transport.js"></script>  
<script src="<?php echo Yii::app()->baseUrl;?>/js/jquery.fileupload.js"></script>  

<script>  
//上传图片
function uploadimg (id) {
	   $('#uploadimg'+id).fileupload({         	
	        dataType: 'json',       
	        url: '/Attachment/GetAjax',        
	        success: function (json) {
	               if(json.upfile.errors=='1'){
	               		alert(json.upfile.msg);
	               }else if(json.upfile.errors=='2'){
	               		alert(json.upfile.msg);
	               }else{
		                 //修改按钮图标
		            	 $('#img'+id).attr('src',json.upfile.file);
						 //修改按钮文本
		            	 $('#uploadimg'+id).parent().html('修改图片<b class="mem_bgx left"></b><b class="mem_bgx right"></b><input type="file" id="uploadimg'+id+'" multiple name="image"/>');
		            	 //填加删除按钮
		            	 if(!$('#img'+id).parent().parent().find('a')[1]){
		            		 $('#img'+id).parent().parent().find('a').eq(0).after('<a class="mem_bgx link_btn" href="javascript:" onclick="removeimg(\''+id+'\')">删除图片<b class="mem_bgx left"></b><b class="mem_bgx right"></b></a>');
		            	 }
						 //修改隐藏域值
	               		 $('#proimage'+id).attr('value',json.upfile.file);
	               } 	
	        }
	    });
};
//删除图片
function removeimg(id){
	$('#img'+id).parent().parent().find('a').eq(0).html('上传图片<b class="mem_bgx left"></b><b class="mem_bgx right"></b><input type="file" id="uploadimg'+id+'" multiple name="image"/>');
	$('#img'+id).parent().parent().find('a').eq(1).remove();
	$('#img'+id).attr('src','/images/pro_img.jpg');
	$('#proimage'+id).attr('value','');
}


</script>
